﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HotLinkProduct_Select_Window.aspx.cs" Inherits="CNVP.JShop.Web.Admin.CommonWindows.HotLinkProduct_Select_Window" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title><%=CNVP.Config.UIConfig.SiteName%></title>
    <link href="../CSS/Global.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/List.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery.js" type="text/javascript"></script>
    <script src="../../Scripts/Common.js" type="text/javascript"></script>
    <script src="../Common/Option.js" type="text/javascript"></script>
    <script type="text/javascript">
        function ProTypeRefBranks() {
            var ddlProductTypeID = document.getElementById("<% =ddlProductTypeID.ClientID %>").value;
            var lbBrandID = document.getElementById("<% =lbBrandID.ClientID %>");

            var lbProBrandID = document.getElementById("<% =lbProBrandID.ClientID %>").innerHTML;
            lbBrandID.innerHTML = GetAjaxResponse("AjaxBranksIDS.aspx?lbProBrandID=" + lbProBrandID + "&ProductTypeID=" + ddlProductTypeID);

        }
    </script>
    <script type="text/javascript">
        function addSelectedAll() {
            var check = $("#checkedAll").attr("checked");
            //alert(check);
            var checkBoxs = $(".ListTable :checkbox:gt(0)");
            //alert(checkBoxs.length);
            for (var i = 0; i < checkBoxs.length; i++) {
                //addSelected(checkBoxs[i]);
                var id = $(checkBoxs[i]).attr("id");
                var inputs = $("#divSelected :input");
                for (var j = 0; j < inputs.length; j++) {
                    var input = inputs[j];
                    if ($(input).attr("checkboxID") == id) {
                        $(input).parent().remove();
                        //return;
                        break;
                    }
                } 
                if (check) {
                    var mes = "<div style=\"float:left\"><input type='checkbox' checked='true' productID='" + $(checkBoxs[i]).next(".ProductName").attr("productID") + "' checkboxID='" + id + "' class='chkSelected' value='" + $(checkBoxs[i]).next(".ProductName").val() + "' />" + $(checkBoxs[i]).next(".ProductName").val() + "</div>";
                    $("#divSelected").append(mes);
                }
            }
        }
        function addSelected(e) {
            var id = $(e).attr("id");
            var inputs = $("#divSelected :input");
            for (var i = 0; i < inputs.length; i++) {
                var input = inputs[i];
                if ($(input).attr("checkboxID") == id) {
                    $(input).parent().remove();
                    return;
                }
            }
            if (!$(e).next(".ProductName")) {
                return;
            } 
                var mes = "<div style=\"float:left\"><input type='checkbox' checked='true' productID='" + $(e).next(".ProductName").attr("productID") + "' checkboxID='" + id + "' class='chkSelected' value='" + $(e).next(".ProductName").val() + "' />" + $(e).next(".ProductName").val() + "</div>";
                $("#divSelected").append(mes);
 
            //$(e).attr("checked",'')
        }
        $('.chkSelected').live('click', function () {
            $("#"+$(this).attr("checkboxID")).attr("checked","");
            $(this).parent().remove();
        });

        function returnValue() {
            var inputs = $("#divSelected :input");
            var value = "";
            for (var i = 0; i < inputs.length; i++) {
                var input = inputs[i];
                value += $(input).attr("productID") + ",";
            }
            top.returnValue = value;
            top.close();
        }
    </script>

</head>
<body onload="ActiveCoolTable();ProTypeRefBranks();">
    <form id="form1" runat="server">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    <table border="0" cellspacing="0" cellpadding="0" class="Option">
  <tr>
    <td>
        <div class="EditBtn">  
        <asp:Button ID="btUp" runat="server" Text="确定"  OnClick="btUp_Click"/>
        </div>
    </td>
  </tr>
</table>
</td>
    <td align="right">
         关键词：
        <asp:TextBox ID="txtkey" runat="server"></asp:TextBox>
        <asp:ImageButton ID="btSearch" runat="server" ImageUrl="../images/Dot17.png" onclick="btSearch_Click" />
        <a href="javascript:void(0);" onclick="showQueDetail(true);" class="link_quedetail">高级检索</a>
        <div id="div_quedetail" class="HighSearch">
            <table width="100%" align="center" cellspacing="0" cellpadding="0" class="EditTable" >
                <tr>
                    <td colspan="2" align="right"><img src="../images/ListClose.gif" onclick="showQueDetail(false);" style="cursor:pointer" title="关闭检索" alt="" /></td>
                </tr>
                <tr>
                    <td class="EditTitle">关 键 字：</td>
                    <td align="left" ><asp:TextBox ID="txtkey1" runat="server" Width="160px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td class="EditTitle">商品分类：</td>
                    <td align="left" >
                        <asp:DropDownList ID="ddlProductClassID" runat="server" Width="160px" ></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="EditTitle">商品类型：</td>
                    <td align="left" >
                        <asp:DropDownList ID="ddlProductTypeID" runat="server" Width="160px"></asp:DropDownList>
                    </td>
                </tr>
                 <tr>
                    <td class="EditTitle">商品品牌：</td>
                    <td align="left" >
                        <asp:Label ID="lbBrandID" runat="server"></asp:Label>
                        <asp:Label ID="lbProBrandID" runat="server" CssClass="Display"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="EditTitle">商品状态：</td>
                    <td align="left" >
                        <asp:DropDownList ID="ddlProductState" runat="server" Width="160px">
                            <asp:ListItem Value="">--请选择--</asp:ListItem>
                            <asp:ListItem Value="1">上架</asp:ListItem>
                            <asp:ListItem Value="0">下架</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                <td colspan="2">
                    <div class="EditBtn">
                        <asp:Button ID="btHighSearch" runat="server" Text=" 检 索 " onclick="btHighSearch_Click"  class="EditBtn" />
                        <input type="button" value="关 闭" class="list_search_btn" onclick="showQueDetail(false);"/>
                    </div>
                    </td>
                </tr>
            </table>
            </div>
    </td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td>
       <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ListTable">
       
        <asp:Repeater ID="rpList" runat="server" onitemcommand="rpList_ItemCommand" >
                <HeaderTemplate>
                     <thead>
                       <tr>
                        <th class="CheckBox"><input onclick="checkAllLine();" id="checkedAll" name="checkedAll" type="checkbox" title="全部选择/全部不选" /></th>
                        <th ><asp:LinkButton ID="ImgProLoad" Runat="server" text="图片" CommandName="ImgProLoad"></asp:LinkButton></th>
                        <th><asp:LinkButton ID="ProductName" Runat="server" text="产品名称" CommandName="ProductName"></asp:LinkButton></th>
                        <th>操作</th>
                       </tr>
                        </thead>
                         <tbody>
                </HeaderTemplate>
                <ItemTemplate>
                       <tr>
                        <td class="CheckBox">
                        <asp:CheckBox id="cbCheck" runat="server"  ToolTip='<%#Eval("ID")%>'   ></asp:CheckBox>
                         <input type="hidden" class="ProductName"  productID="<%#Eval("ID")%>" value="<%#Eval("ProductName")%>" name="ProductName"/>
                        </td>
                        <td>
                        <a href="/ProductDetail_<%#Eval("ProductClassID")%>_<%#Eval("ID")%>.aspx" target="_blank" title="<%#Eval("ProductName")%>">
                         <img alt="" src='../../UploadFile/Product/<%#Eval("ImgProLoad")%>' width="100px" height="40px" />
                         </a>
                        </td>
                        <td>
                        <a href="/ProductDetail_<%#Eval("ProductClassID")%>_<%#Eval("ID")%>.aspx" target="_blank" title="<%#Eval("ProductName")%>">
                        <%# CNVP.Framework.BasePage.CutString(Eval("ProductName").ToString(),40)%>
                        </a>
                        </td>
                        <td><asp:LinkButton ID="linkBTSelect" runat="server" CommandName="Select" CommandArgument='<%#Eval("ID")%>'>选择</asp:LinkButton></td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </tbody>
                </FooterTemplate>
        </asp:Repeater>
              <tfoot>
                      <tr><td colspan="8"><div id="paging" runat="server"></div></td></tr>
                      </tfoot>
                    </table>

    </td>
  </tr>
  <tr>
  <td>
  <div id="divSelected"></div>
  </td>
  </tr>
</table>
    </form>
</body>
</html>
